﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MediaAutomatorConsole.Configuration
{
    public class MediaAutomatorConfiguration : ConfigurationSection
    {
        private const string ConfigurationSectionName = "mediaAutomator";

        public static MediaAutomatorConfiguration GetConfig()
        {
            return (MediaAutomatorConfiguration)ConfigurationManager.GetSection(ConfigurationSectionName)
                ?? new MediaAutomatorConfiguration();
        }


        [ConfigurationProperty("logs", IsRequired = true)]
        public string Logs
        {
            get
            {
                return this["logs"] as string;
            }
        }


        [ConfigurationProperty("directories")]
        public DirectoriesElement Directories
        {
            get
            {
                return (DirectoriesElement)this["directories"] ??
                   new DirectoriesElement();
            }
        }


        [ConfigurationProperty("theRenamer")]
        public TheRenamerElement TheRenamer
        {
            get
            {
                return (TheRenamerElement)this["theRenamer"] ??
                   new TheRenamerElement();
            }
        }

        [ConfigurationProperty("xbmc")]
        public XbmcElement Xbmc
        {
            get
            {
                return (XbmcElement)this["xbmc"] ??
                   new XbmcElement();
            }
        }

        [ConfigurationProperty("utorrent")]
        public UTorrentElement UTorrent
        {
            get
            {
                return (UTorrentElement)this["utorrent"] ??
                   new UTorrentElement();
            }
        }

        [ConfigurationProperty("recognizers")]
        public RecognizersCollection Recognizers
        {
            get
            {
                return (RecognizersCollection)this["recognizers"] ??
                   new RecognizersCollection();
            }
        }
        
        [ConfigurationProperty("ignorers")]
        public IgnorersCollection Ignorers
        {
            get
            {
                return (IgnorersCollection)this["ignorers"] ??
                   new IgnorersCollection();
            }
        }

    }
}
